/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 * };
 */

bool isSameTree(struct TreeNode* p, struct TreeNode* q){
    // 判断结构
    if(p == NULL && q == NULL)
        return true;  // 都为空树
    if(p == NULL || q == NULL)
        return false;   // 一个为空 一个不为空
   
    // 判断val
    if(p->val != q->val)
        return false;
    return isSameTree(p->left, q->left) && isSameTree(p->right, q->right);
}